package com.czl.elm.config.rabbitmq;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;




/**
 * RabbitMQ配置类
 */

@Configuration
public class RabbitMQConfig {
    public static final String SECKILLQUEUE="seckillQueue";
    public static final String EXCHANGE="sec_exchange";
    public static final String ROUNTKEY="seckillRT";
    @Bean
    public Queue queue(){
        return new Queue(SECKILLQUEUE,true);
    }

    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange(EXCHANGE);
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(directExchange()).with(ROUNTKEY);
    }





}